﻿#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using BreakOutBattles.Game;
#endregion

namespace BreakOutBattles.Game.Items
{
    /// <summary>
    /// A base class for all items in the game.
    /// </summary>
    public abstract class GameItem
    {
        #region Fields
        protected Vector2 initialLocation;
        protected Vector2 currentLocation;
        protected Texture2D itemTexture;
        protected Rectangle collisionRect;
        protected bool active;
        protected bool locked = false;
        #endregion


        public GameItem(Vector2 location, Texture2D itemTexture)
        {
            this.itemTexture = itemTexture;
            initialLocation = location;
            currentLocation = location;
            active = true;
            collisionRect = new Rectangle(0, 0, itemTexture.Width, itemTexture.Height);
        }

        public GameItem()
        {
            active = true;
        }

        public virtual void Reset()
        {
            currentLocation = initialLocation;
            active = true;
        }

        public bool Active
        {
            get { return active; }
            set { active = value; }
        }
    
        public virtual void Update(GameTime gameTime)
        { }

        public virtual void Draw(SpriteBatch spriteBatch)
        {
            if (Active && itemTexture != null)
            {
                spriteBatch.Draw(itemTexture, currentLocation, Color.White);
            }
        }
    }
}
